#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
const int N = 10;
char s[N],ans[N];
bool vis[N];
int len;

void dfs(int x) {
	if (x == len) {
		cout << ans << endl;
		return;
	}
	for (int i = 0; i < len; i++) {
		if (!vis[i]) {
			vis[i] = true;
			ans[x] = s[i];
			dfs(x + 1);
			vis[i] = false;
		}
	}
}

int main() {
	cin >> s;
	len = strlen(s);
	dfs(0);
	return 0;
}